﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SWEN_HMS.Classes;

namespace SWEN_HMS.UserModule
{
    public partial class AccountManagement : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["staffid"] == null)
            {
                Response.Redirect("~/UserModule/Login.aspx");
            }
            else if ((Convert.ToString(Session["accessLvl"])) == "No Access")
            {
                Response.Redirect("~/UserModule/Login.aspx");
            }
            else
            {
                if (!Page.IsPostBack)
                {

                    int id = Convert.ToInt32(Session["staffid"]);
                    staff s = userDB.getDetailByStaffID(id);
                    if (s != null)
                    {
                        lblStaffID.Text = Convert.ToString(id);
                        lblStaffName.Text = s.staffName;
                        lblDOB.Text = string.Format("{0:dd/MM/yyyy}", s.dob);
                        lblEmail.Text = s.email;
                        lblContact.Text = Convert.ToString(s.contactNo);
                        lbladdress.Text = s.address;
                        lblAccount.Text = Convert.ToString(s.accountNo);
                        lblBank.Text = s.bankType;
                    }


                }
            }

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/UserModule/Update.aspx");
        }

        protected void btnPW_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/UserModule/ChangePassword.aspx");
        }
    }
}